package com.xce.common;

import lombok.Data;

/**
 * @ClassName R
 * @Description TODO
 * @Author lld
 * @Date 2025/7/3 23:01
 * @Version 1.0
 */
@Data
public class R {

    private Integer code;
    private String message;
    private Object data;

    public static R error() {
        R r = new R();
        r.setCode(500);
        return r;
    }

    public static R success() {
        R r = new R();
        r.setCode(200);
        return r;
    }

    public static R error(String message) {
        R r = new R();
        r.setCode(500);
        r.setMessage(message);
        return r;
    }

    public static R success(String message, Object data) {
        R r = new R();
        r.setCode(200);
        r.setMessage(message);
        r.setData(data);
        return r;
    }
}
